package com.jf3q.front.controller;

//import com.alipay.easysdk.kernel.util.JsonUtil;

import com.jf3q.common.vo.ResultVo;
import com.jf3q.front.service.EduOrderService;
import com.jf3q.front.service.EduPayLogService;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

import java.util.*;

@RestController
@RequestMapping("/pay")
@Tag(name = "后台购买模块")
public class PayController {

    @Autowired
    EduOrderService orderService;
    @Autowired
    EduPayLogService payLogService;


    @GetMapping("/createNative/{orderNo}")
    public ResultVo createNative(@PathVariable String orderNo) {
        //返回信息，包含二维码地址，还有其他需要的信息
        Map map = payLogService.createNatvie(orderNo);
        System.out.println("****返回二维码map集合:" + map);
        return ResultVo.success(map);
    }


    //查询订单支付状态
    //参数：订单号，根据订单号查询 支付状态
    @GetMapping("/queryPayStatus/{orderNo}")
    public ResultVo queryPayStatus(@PathVariable String orderNo) {
        payLogService.queryPayStatus(orderNo);
        return ResultVo.success();
    }
}
